<?php
require_once 'helper.php';

if (!isset($_REQUEST["grin"]) || !isset($_REQUEST["filename"]))
{
  echo "ERROR";
  exit;
}


$filename = nextFilename($_REQUEST["filename"]);
$code = $_REQUEST["grin"];
$wasSaved = createFlash("{$filename}.grin","{$filename}.swf",$code);
echo $wasSaved == "File {$filename}.swf generated. Enjoy." ? "{$filename}.swf" : "ERROR";

?>
